package com.example.demo.mapper;

import com.example.demo.model.Student;
import org.apache.catalina.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * user:likai
 * Date:2023-02-02
 * Time:21:52
 */
//注解上是mybatis的
@Mapper
public interface UserMapper {
    //查询所有结果
    public List<Student> getAll();
    //传入参数进行查询
    public List<Student> getById(@Param("id") Integer id);
    //添加功能
    public Integer add(@Param("studen") Student student);
    //添加并且获得他的自增主键
    public Integer addAndId(@Param("student") Student student);
    //删除功能
    public Integer deleteById(@Param("id") Integer id);
    //修改name
    public Integer update(@Param("name") String  name,@Param("id") Integer id);
    //like查询
    public List<Student> getLike(@Param("name") String name);
    //动态sql
    //if标签
    public Integer addSelect(@Param("name") String  name,@Param("id") Integer id);
    //trim标签
    public Integer addSelect1(@Param("name") String  name,@Param("id") Integer id);
    //where标签
    public List<Student> selectWhere(@Param("id") Integer id,@Param("name") String name);
    //update标签
    public Integer updateSet(@Param("id") Integer id,@Param("name") String name);
    //foreach标签
    public List<Student> selectEach(@Param("list") List<Integer> list);
}
